package cc.iotkit.generator.controller;

import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.generator.dto.bo.RuleByPksBo;
import cc.iotkit.generator.service.RuleInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"规则引擎"})
@RestController
@RequiredArgsConstructor
@RequestMapping("/rule-info")
public class RuleInfoController {
    private final RuleInfoService ruleInfoService;

    /**
     * 根据分组ID查询规则列表
     */
    @ApiOperation("根据分组ID查询规则列表")
    @PostMapping("/rulesByGroupId/{groupId}")
    public Paging<RuleByPksBo> rulesByGroupId(@PathVariable String groupId, @RequestBody PageRequest<RuleByPksBo> request) {
        return ruleInfoService.rulesByGroupId(groupId, request);
    }
}
